﻿using Acme.SmartWMS.Outbound.DispatchDetailService;
using Microsoft.AspNetCore.Mvc;
using System.Linq.Dynamic.Core;
using System.Threading.Tasks;

namespace Acme.SmartWMS.Web.Controllers.Outbound
{
    public class DispatchDetailController : Controller
    {
        /// <summary>
        /// 出库明细服务类
        /// </summary>
        private readonly IDispatchDetailsAppService _dispatchDetailsAppService;
        public DispatchDetailController(IDispatchDetailsAppService dispatchDetailsAppService)
        {
            _dispatchDetailsAppService = dispatchDetailsAppService;
        }

        public IActionResult DispatchDetailList()
        {
            return View();
        }
        /// <summary>
        /// 获取出库明细显示 查询 分页
        /// </summary>
        /// <param name="page"></param>
        /// <param name="limit"></param>
        /// <param name="productCode"></param>
        /// <param name="productName"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<JsonResult> GetDispatchDetailList(int page, int limit, string? productCode, string? productName)
        {
            var dispatchDetail=await _dispatchDetailsAppService.GetDispatchDetailList(page, limit, productCode, productName);
            return Json(new {code=0,data=dispatchDetail.Queryable,count=dispatchDetail.RowCount });
        }
    }
}
